{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6cb602d4-e208-42ac-88fc-9e9768c77589",
   "metadata": {},
   "outputs": [],
   "source": [
    "from mindsponge import Sponge\n",
    "from mindsponge import Molecule\n",
    "from mindsponge import ForceField\n",
    "from mindsponge import UpdaterMD\n",
    "from mindsponge import WithEnergyCell\n",
    "from mindsponge.function import VelocityGenerator\n",
    "from mindsponge.callback import WriteH5MD, RunInfo\n",
    "from mindsponge.optimizer import SteepestDescent\n",
    "from mindspore import context"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f9571cf2",
   "metadata": {},
   "outputs": [],
   "source": [
    "context.set_context(mode=context.GRAPH_MODE, device_target=\"GPU\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6a33a60b-08b8-42f4-8a78-b6553d418e4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Parameter (name=pbc_box, shape=(1, 3), dtype=Float32, requires_grad=True)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "system = Molecule(template='water.spce.yaml')\n",
    "system.set_pbc_box([0.4, 0.4, 0.4])"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "c199fd38-25ff-40bf-bc35-02255f10017e",
   "metadata": {},
   "source": [
    "如果定义了周期性的盒子，那么还可以使用repeat_box功能来扩展/复制系统，比如可以这样将系统复制1000份"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d1be6458-a40f-428c-8667-35472bd7a811",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Molecule<>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "system.repeat_box([10, 10, 10])"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "39ebe6b6-f38e-4789-bd3a-21ebfd571324",
   "metadata": {},
   "source": [
    "得到的分子系统的示意图如下所示：\n",
    "![](../../docs/tutorial_b05.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "013928f0-8217-48b8-87b8-4983e42c4db8",
   "metadata": {},
   "outputs": [],
   "source": [
    "potential = ForceField(system, parameters='SPCE')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "eaa250b5-17e8-4513-9a35-3f25ad00fb72",
   "metadata": {},
   "outputs": [],
   "source": [
    "opt = SteepestDescent(system.trainable_params(), 1e-6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "45386747-2f06-4157-8557-43cfed2f35ce",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[MindSPONGE] Calculate the neighbour list using the inter-atomic distances.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[WARNING] KERNEL(16275,7fb231e5f500,python):2023-06-30-16:30:32.093.915 [mindspore/ccsrc/plugin/device/gpu/kernel/gpu_kernel.cc:40] CheckDeviceSm] It is recommended to use devices with a computing capacity >= 7, but the current device's computing capacity is 6\n"
     ]
    }
   ],
   "source": [
    "sim = WithEnergyCell(system, potential, cutoff=1.0)\n",
    "md = Sponge(sim, optimizer=opt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ec6d41b5-8da8-4add-a2b7-6e6754be5742",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[MindSPONGE] Started simulation at 2023-06-30 16:30:34\n",
      "[MindSPONGE] Step: 0, E_pot: -7163.629\n",
      "[MindSPONGE] Step: 10, E_pot: -7715.919\n",
      "[MindSPONGE] Step: 20, E_pot: -7753.052\n",
      "[MindSPONGE] Step: 30, E_pot: -7755.6426\n",
      "[MindSPONGE] Step: 40, E_pot: -7755.8687\n",
      "[MindSPONGE] Step: 50, E_pot: -7755.8633\n",
      "[MindSPONGE] Step: 60, E_pot: -7756.2056\n",
      "[MindSPONGE] Step: 70, E_pot: -7756.234\n",
      "[MindSPONGE] Step: 80, E_pot: -7756.2017\n",
      "[MindSPONGE] Step: 90, E_pot: -7756.1987\n",
      "[MindSPONGE] Finished simulation at 2023-06-30 16:30:42\n",
      "[MindSPONGE] Simulation time: 8.48 seconds.\n",
      "--------------------------------------------------------------------------------\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<mindsponge.core.sponge.Sponge at 0x7fb158151fa0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "run_info = RunInfo(10)\n",
    "md.run(100, callbacks=[run_info])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d30ca198-6e5e-4ec2-a64c-99d1e254f959",
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = 300\n",
    "vgen = VelocityGenerator(temp)\n",
    "velocity = vgen(system.shape, system.atom_mass)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "73e8a6d6-7f4b-4b0e-9fc8-1965bd5fb32b",
   "metadata": {},
   "outputs": [],
   "source": [
    "opt = UpdaterMD(system=system,\n",
    "                time_step=1e-3,\n",
    "                velocity=velocity,\n",
    "                integrator='velocity_verlet',\n",
    "                temperature=300,\n",
    "                thermostat='langevin',\n",
    "                pressure=1,\n",
    "                barostat='berendsen',)\n",
    "md = Sponge(sim, optimizer=opt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "7a20e0e2-8906-4f88-b315-804ac193aa9a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<mindsponge.core.sponge.Sponge at 0x7fb108186070>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "md.change_optimizer(opt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "dc3c3c5c-4106-44ce-99f8-d842983762d9",
   "metadata": {},
   "outputs": [],
   "source": [
    "cb_h5md = WriteH5MD(system, 'tutorial_b05.h5md', save_freq=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "173b4f21-81f0-4e06-9375-09132fcd254d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[MindSPONGE] Started simulation at 2023-06-30 16:30:49\n",
      "[MindSPONGE] Step: 0, E_pot: -7756.2026, E_kin: 11063.09, E_tot: 3306.8872, Temperature: 295.7839, Pressure: 608.6257, Volume: 64.0\n",
      "[MindSPONGE] Step: 10, E_pot: -7417.774, E_kin: 10621.939, E_tot: 3204.1655, Temperature: 283.98926, Pressure: 137.68718, Volume: 63.98105\n",
      "[MindSPONGE] Step: 20, E_pot: -7861.0137, E_kin: 11176.844, E_tot: 3315.83, Temperature: 298.82523, Pressure: -215.94531, Volume: 63.95007\n",
      "[MindSPONGE] Step: 30, E_pot: -9193.785, E_kin: 12348.748, E_tot: 3154.963, Temperature: 330.15738, Pressure: -1186.9487, Volume: 63.89784\n",
      "[MindSPONGE] Step: 40, E_pot: -10421.905, E_kin: 13303.73, E_tot: 2881.8252, Temperature: 355.6899, Pressure: -1905.3464, Volume: 63.82028\n",
      "[MindSPONGE] Step: 50, E_pot: -10846.889, E_kin: 13384.538, E_tot: 2537.6494, Temperature: 357.8504, Pressure: -2145.1445, Volume: 63.725357\n",
      "[MindSPONGE] Step: 60, E_pot: -11004.227, E_kin: 13101.414, E_tot: 2097.1875, Temperature: 350.28076, Pressure: -2609.2415, Volume: 63.628387\n",
      "[MindSPONGE] Step: 70, E_pot: -11264.527, E_kin: 12981.344, E_tot: 1716.8164, Temperature: 347.07056, Pressure: -3076.786, Volume: 63.530323\n",
      "[MindSPONGE] Step: 80, E_pot: -11834.169, E_kin: 13056.67, E_tot: 1222.501, Temperature: 349.08447, Pressure: -3480.1042, Volume: 63.432434\n",
      "[MindSPONGE] Step: 90, E_pot: -12685.1045, E_kin: 13410.289, E_tot: 725.1846, Temperature: 358.53885, Pressure: -3966.5906, Volume: 63.33525\n",
      "[MindSPONGE] Step: 100, E_pot: -13527.288, E_kin: 13891.412, E_tot: 364.12402, Temperature: 371.40222, Pressure: -4066.727, Volume: 63.23704\n",
      "[MindSPONGE] Step: 110, E_pot: -14465.99, E_kin: 14112.718, E_tot: -353.27246, Temperature: 377.31906, Pressure: -4142.6914, Volume: 63.142555\n",
      "[MindSPONGE] Step: 120, E_pot: -15268.477, E_kin: 14233.6045, E_tot: -1034.8721, Temperature: 380.55112, Pressure: -4140.1475, Volume: 63.05415\n",
      "[MindSPONGE] Step: 130, E_pot: -16022.1045, E_kin: 14391.046, E_tot: -1631.0586, Temperature: 384.7605, Pressure: -3917.0723, Volume: 62.970478\n",
      "[MindSPONGE] Step: 140, E_pot: -16789.78, E_kin: 14416.693, E_tot: -2373.086, Temperature: 385.4462, Pressure: -3464.3308, Volume: 62.891914\n",
      "[MindSPONGE] Step: 150, E_pot: -17531.79, E_kin: 14527.012, E_tot: -3004.7773, Temperature: 388.39566, Pressure: -3292.236, Volume: 62.817787\n",
      "[MindSPONGE] Step: 160, E_pot: -18024.898, E_kin: 14477.869, E_tot: -3547.0293, Temperature: 387.08182, Pressure: -2938.1714, Volume: 62.74515\n",
      "[MindSPONGE] Step: 170, E_pot: -18607.213, E_kin: 14134.086, E_tot: -4473.127, Temperature: 377.89038, Pressure: -2635.3228, Volume: 62.678944\n",
      "[MindSPONGE] Step: 180, E_pot: -19342.158, E_kin: 14592.416, E_tot: -4749.742, Temperature: 390.14435, Pressure: -2767.5642, Volume: 62.61494\n",
      "[MindSPONGE] Step: 190, E_pot: -19727.979, E_kin: 14098.951, E_tot: -5629.0273, Temperature: 376.95102, Pressure: -2567.81, Volume: 62.554432\n",
      "[MindSPONGE] Step: 200, E_pot: -20439.441, E_kin: 14147.619, E_tot: -6291.8223, Temperature: 378.2522, Pressure: -2388.9246, Volume: 62.495567\n",
      "[MindSPONGE] Step: 210, E_pot: -20842.121, E_kin: 13994.7295, E_tot: -6847.3916, Temperature: 374.16452, Pressure: -2232.3188, Volume: 62.438293\n",
      "[MindSPONGE] Step: 220, E_pot: -21498.256, E_kin: 13923.262, E_tot: -7574.994, Temperature: 372.25375, Pressure: -2201.5806, Volume: 62.38061\n",
      "[MindSPONGE] Step: 230, E_pot: -22096.531, E_kin: 13962.256, E_tot: -8134.2754, Temperature: 373.2963, Pressure: -2475.58, Volume: 62.316338\n",
      "[MindSPONGE] Step: 240, E_pot: -22430.809, E_kin: 13914.256, E_tot: -8516.553, Temperature: 372.01297, Pressure: -2398.9702, Volume: 62.251144\n",
      "[MindSPONGE] Step: 250, E_pot: -23006.33, E_kin: 13911.344, E_tot: -9094.986, Temperature: 371.93512, Pressure: -2347.1638, Volume: 62.182312\n",
      "[MindSPONGE] Step: 260, E_pot: -23365.922, E_kin: 13843.766, E_tot: -9522.156, Temperature: 370.12833, Pressure: -2140.5957, Volume: 62.10998\n",
      "[MindSPONGE] Step: 270, E_pot: -23624.559, E_kin: 13742.664, E_tot: -9881.895, Temperature: 367.42526, Pressure: -2044.3389, Volume: 62.040665\n",
      "[MindSPONGE] Step: 280, E_pot: -24002.723, E_kin: 13710.74, E_tot: -10291.982, Temperature: 366.57175, Pressure: -1856.9109, Volume: 61.977566\n",
      "[MindSPONGE] Step: 290, E_pot: -24595.922, E_kin: 13711.188, E_tot: -10884.733, Temperature: 366.58374, Pressure: -1730.2678, Volume: 61.91414\n",
      "[MindSPONGE] Step: 300, E_pot: -25068.195, E_kin: 13552.379, E_tot: -11515.816, Temperature: 362.3378, Pressure: -1604.0564, Volume: 61.851887\n",
      "[MindSPONGE] Step: 310, E_pot: -25416.762, E_kin: 13468.378, E_tot: -11948.384, Temperature: 360.09195, Pressure: -1583.033, Volume: 61.789745\n",
      "[MindSPONGE] Step: 320, E_pot: -25842.9, E_kin: 13330.604, E_tot: -12512.297, Temperature: 356.4084, Pressure: -1498.9924, Volume: 61.72997\n",
      "[MindSPONGE] Step: 330, E_pot: -26277.309, E_kin: 13374.779, E_tot: -12902.529, Temperature: 357.58948, Pressure: -1791.0879, Volume: 61.673546\n",
      "[MindSPONGE] Step: 340, E_pot: -26588.383, E_kin: 13285.541, E_tot: -13302.842, Temperature: 355.20358, Pressure: -1972.5098, Volume: 61.61837\n",
      "[MindSPONGE] Step: 350, E_pot: -27036.951, E_kin: 13237.483, E_tot: -13799.468, Temperature: 353.91873, Pressure: -2195.1167, Volume: 61.563164\n",
      "[MindSPONGE] Step: 360, E_pot: -27352.66, E_kin: 13340.908, E_tot: -14011.752, Temperature: 356.6839, Pressure: -2257.1934, Volume: 61.50351\n",
      "[MindSPONGE] Step: 370, E_pot: -27572.928, E_kin: 13249.574, E_tot: -14323.354, Temperature: 354.24197, Pressure: -2133.1538, Volume: 61.443474\n",
      "[MindSPONGE] Step: 380, E_pot: -27847.996, E_kin: 13136.707, E_tot: -14711.289, Temperature: 351.22433, Pressure: -2250.6816, Volume: 61.38719\n",
      "[MindSPONGE] Step: 390, E_pot: -28103.65, E_kin: 13109.229, E_tot: -14994.422, Temperature: 350.4897, Pressure: -2260.5378, Volume: 61.32713\n",
      "[MindSPONGE] Step: 400, E_pot: -28474.031, E_kin: 13143.524, E_tot: -15330.507, Temperature: 351.40665, Pressure: -2257.258, Volume: 61.265404\n",
      "[MindSPONGE] Step: 410, E_pot: -28720.26, E_kin: 13091.881, E_tot: -15628.379, Temperature: 350.02588, Pressure: -2175.8945, Volume: 61.20298\n",
      "[MindSPONGE] Step: 420, E_pot: -29055.326, E_kin: 13012.879, E_tot: -16042.447, Temperature: 347.9137, Pressure: -1751.5476, Volume: 61.14295\n",
      "[MindSPONGE] Step: 430, E_pot: -29099.844, E_kin: 12680.451, E_tot: -16419.393, Temperature: 339.02585, Pressure: -1657.043, Volume: 61.086994\n",
      "[MindSPONGE] Step: 440, E_pot: -29471.238, E_kin: 12805.414, E_tot: -16665.824, Temperature: 342.36688, Pressure: -1785.7914, Volume: 61.033512\n",
      "[MindSPONGE] Step: 450, E_pot: -29862.807, E_kin: 12882.503, E_tot: -16980.305, Temperature: 344.42792, Pressure: -1837.136, Volume: 60.97914\n",
      "[MindSPONGE] Step: 460, E_pot: -30181.578, E_kin: 12672.853, E_tot: -17508.727, Temperature: 338.8227, Pressure: -1535.7781, Volume: 60.92805\n",
      "[MindSPONGE] Step: 470, E_pot: -30644.803, E_kin: 12778.499, E_tot: -17866.305, Temperature: 341.64728, Pressure: -1581.3501, Volume: 60.876312\n",
      "[MindSPONGE] Step: 480, E_pot: -30587.514, E_kin: 12569.208, E_tot: -18018.305, Temperature: 336.05164, Pressure: -1656.1719, Volume: 60.823566\n",
      "[MindSPONGE] Step: 490, E_pot: -30720.473, E_kin: 12559.175, E_tot: -18161.297, Temperature: 335.7834, Pressure: -1739.5277, Volume: 60.775192\n",
      "[MindSPONGE] Step: 500, E_pot: -30934.254, E_kin: 12443.568, E_tot: -18490.686, Temperature: 332.69254, Pressure: -1516.1042, Volume: 60.72734\n",
      "[MindSPONGE] Step: 510, E_pot: -31057.105, E_kin: 12457.256, E_tot: -18599.85, Temperature: 333.05847, Pressure: -1481.6018, Volume: 60.67965\n",
      "[MindSPONGE] Step: 520, E_pot: -31324.88, E_kin: 12589.834, E_tot: -18735.047, Temperature: 336.60312, Pressure: -1361.0078, Volume: 60.62952\n",
      "[MindSPONGE] Step: 530, E_pot: -31414.42, E_kin: 12175.916, E_tot: -19238.504, Temperature: 325.53653, Pressure: -1338.1345, Volume: 60.581017\n",
      "[MindSPONGE] Step: 540, E_pot: -31531.555, E_kin: 12161.206, E_tot: -19370.348, Temperature: 325.14325, Pressure: -1666.577, Volume: 60.530037\n",
      "[MindSPONGE] Step: 550, E_pot: -31742.092, E_kin: 12326.604, E_tot: -19415.488, Temperature: 329.56534, Pressure: -1606.5613, Volume: 60.480698\n",
      "[MindSPONGE] Step: 560, E_pot: -31959.705, E_kin: 12303.341, E_tot: -19656.363, Temperature: 328.9434, Pressure: -1522.6948, Volume: 60.428837\n",
      "[MindSPONGE] Step: 570, E_pot: -32134.816, E_kin: 12250.004, E_tot: -19884.812, Temperature: 327.51736, Pressure: -1719.6674, Volume: 60.37289\n",
      "[MindSPONGE] Step: 580, E_pot: -32428.049, E_kin: 12204.753, E_tot: -20223.297, Temperature: 326.30753, Pressure: -2427.9392, Volume: 60.315372\n",
      "[MindSPONGE] Step: 590, E_pot: -32615.828, E_kin: 12180.928, E_tot: -20434.9, Temperature: 325.67053, Pressure: -2773.0137, Volume: 60.254612\n",
      "[MindSPONGE] Step: 600, E_pot: -32757.732, E_kin: 12224.388, E_tot: -20533.344, Temperature: 326.8325, Pressure: -2872.981, Volume: 60.19249\n",
      "[MindSPONGE] Step: 610, E_pot: -32960.344, E_kin: 12018.031, E_tot: -20942.312, Temperature: 321.3153, Pressure: -2553.885, Volume: 60.13106\n",
      "[MindSPONGE] Step: 620, E_pot: -32918.79, E_kin: 11937.076, E_tot: -20981.713, Temperature: 319.15088, Pressure: -2234.7192, Volume: 60.070328\n",
      "[MindSPONGE] Step: 630, E_pot: -32959.26, E_kin: 11869.338, E_tot: -21089.924, Temperature: 317.33984, Pressure: -2144.245, Volume: 60.013275\n",
      "[MindSPONGE] Step: 640, E_pot: -32987.4, E_kin: 11813.012, E_tot: -21174.387, Temperature: 315.8339, Pressure: -2037.0833, Volume: 59.962635\n",
      "[MindSPONGE] Step: 650, E_pot: -33187.168, E_kin: 11783.758, E_tot: -21403.41, Temperature: 315.05176, Pressure: -2089.4897, Volume: 59.913307\n",
      "[MindSPONGE] Step: 660, E_pot: -33421.4, E_kin: 12011.809, E_tot: -21409.59, Temperature: 321.14896, Pressure: -2265.8538, Volume: 59.86265\n",
      "[MindSPONGE] Step: 670, E_pot: -33557.68, E_kin: 11927.387, E_tot: -21630.293, Temperature: 318.89185, Pressure: -2232.7893, Volume: 59.814667\n",
      "[MindSPONGE] Step: 680, E_pot: -33582.695, E_kin: 12035.135, E_tot: -21547.56, Temperature: 321.7726, Pressure: -2292.585, Volume: 59.765102\n",
      "[MindSPONGE] Step: 690, E_pot: -33832.438, E_kin: 12063.42, E_tot: -21769.018, Temperature: 322.52884, Pressure: -2304.1736, Volume: 59.715042\n",
      "[MindSPONGE] Step: 700, E_pot: -33983.2, E_kin: 12063.103, E_tot: -21920.098, Temperature: 322.52036, Pressure: -2292.8032, Volume: 59.66454\n",
      "[MindSPONGE] Step: 710, E_pot: -34043.93, E_kin: 11968.949, E_tot: -22074.98, Temperature: 320.00305, Pressure: -2334.7275, Volume: 59.61509\n",
      "[MindSPONGE] Step: 720, E_pot: -34372.582, E_kin: 12045.717, E_tot: -22326.865, Temperature: 322.05554, Pressure: -2269.588, Volume: 59.562824\n",
      "[MindSPONGE] Step: 730, E_pot: -34591.82, E_kin: 11838.073, E_tot: -22753.746, Temperature: 316.50394, Pressure: -2447.96, Volume: 59.50865\n",
      "[MindSPONGE] Step: 740, E_pot: -34698.188, E_kin: 11817.484, E_tot: -22880.703, Temperature: 315.9535, Pressure: -2314.6775, Volume: 59.45123\n",
      "[MindSPONGE] Step: 750, E_pot: -34662.38, E_kin: 11759.944, E_tot: -22902.434, Temperature: 314.41507, Pressure: -2243.1162, Volume: 59.395145\n",
      "[MindSPONGE] Step: 760, E_pot: -34675.67, E_kin: 11778.648, E_tot: -22897.023, Temperature: 314.91516, Pressure: -2226.8447, Volume: 59.339775\n",
      "[MindSPONGE] Step: 770, E_pot: -34722.92, E_kin: 11717.938, E_tot: -23004.984, Temperature: 313.292, Pressure: -1929.0664, Volume: 59.289146\n",
      "[MindSPONGE] Step: 780, E_pot: -34835.82, E_kin: 11936.635, E_tot: -22899.186, Temperature: 319.1391, Pressure: -1671.7015, Volume: 59.237995\n",
      "[MindSPONGE] Step: 790, E_pot: -34878.13, E_kin: 12047.563, E_tot: -22830.566, Temperature: 322.1049, Pressure: -1440.2739, Volume: 59.189877\n",
      "[MindSPONGE] Step: 800, E_pot: -35033.36, E_kin: 11959.255, E_tot: -23074.105, Temperature: 319.74387, Pressure: -1225.4387, Volume: 59.141895\n",
      "[MindSPONGE] Step: 810, E_pot: -35239.28, E_kin: 12052.155, E_tot: -23187.125, Temperature: 322.22766, Pressure: -1183.4851, Volume: 59.089863\n",
      "[MindSPONGE] Step: 820, E_pot: -35038.816, E_kin: 11742.155, E_tot: -23296.66, Temperature: 313.93945, Pressure: -927.6698, Volume: 59.040752\n",
      "[MindSPONGE] Step: 830, E_pot: -35405.426, E_kin: 11817.174, E_tot: -23588.252, Temperature: 315.94516, Pressure: -1195.7389, Volume: 58.992767\n",
      "[MindSPONGE] Step: 840, E_pot: -35403.844, E_kin: 11739.426, E_tot: -23664.418, Temperature: 313.8665, Pressure: -1482.8406, Volume: 58.942993\n",
      "[MindSPONGE] Step: 850, E_pot: -35572.89, E_kin: 11892.113, E_tot: -23680.777, Temperature: 317.94876, Pressure: -1715.7498, Volume: 58.89324\n",
      "[MindSPONGE] Step: 860, E_pot: -35660.0, E_kin: 11755.638, E_tot: -23904.363, Temperature: 314.29993, Pressure: -2156.4712, Volume: 58.835888\n",
      "[MindSPONGE] Step: 870, E_pot: -35637.242, E_kin: 11804.472, E_tot: -23832.77, Temperature: 315.60556, Pressure: -2129.0278, Volume: 58.785053\n",
      "[MindSPONGE] Step: 880, E_pot: -35765.363, E_kin: 11865.129, E_tot: -23900.234, Temperature: 317.2273, Pressure: -2173.2935, Volume: 58.731224\n",
      "[MindSPONGE] Step: 890, E_pot: -35807.836, E_kin: 11762.139, E_tot: -24045.697, Temperature: 314.47372, Pressure: -2298.8586, Volume: 58.677917\n",
      "[MindSPONGE] Step: 900, E_pot: -35711.047, E_kin: 11714.649, E_tot: -23996.398, Temperature: 313.20407, Pressure: -2239.246, Volume: 58.62731\n",
      "[MindSPONGE] Step: 910, E_pot: -35921.77, E_kin: 11708.92, E_tot: -24212.85, Temperature: 313.05087, Pressure: -2030.6162, Volume: 58.575634\n",
      "[MindSPONGE] Step: 920, E_pot: -35938.402, E_kin: 11568.505, E_tot: -24369.898, Temperature: 309.29672, Pressure: -2381.7231, Volume: 58.52358\n",
      "[MindSPONGE] Step: 930, E_pot: -36095.504, E_kin: 11564.709, E_tot: -24530.795, Temperature: 309.19525, Pressure: -2458.2332, Volume: 58.47056\n",
      "[MindSPONGE] Step: 940, E_pot: -36098.01, E_kin: 11577.32, E_tot: -24520.691, Temperature: 309.53244, Pressure: -2263.9932, Volume: 58.421803\n",
      "[MindSPONGE] Step: 950, E_pot: -36158.75, E_kin: 11396.051, E_tot: -24762.7, Temperature: 304.68597, Pressure: -2399.4956, Volume: 58.376045\n",
      "[MindSPONGE] Step: 960, E_pot: -36249.37, E_kin: 11411.731, E_tot: -24837.64, Temperature: 305.10522, Pressure: -2075.885, Volume: 58.32315\n",
      "[MindSPONGE] Step: 970, E_pot: -36142.99, E_kin: 11249.883, E_tot: -24893.105, Temperature: 300.778, Pressure: -1933.363, Volume: 58.275433\n",
      "[MindSPONGE] Step: 980, E_pot: -36531.96, E_kin: 11613.268, E_tot: -24918.693, Temperature: 310.4935, Pressure: -1957.9346, Volume: 58.225315\n",
      "[MindSPONGE] Step: 990, E_pot: -36515.434, E_kin: 11516.039, E_tot: -24999.395, Temperature: 307.89398, Pressure: -1814.8757, Volume: 58.17501\n",
      "[MindSPONGE] Finished simulation at 2023-06-30 16:31:48\n",
      "[MindSPONGE] Simulation time: 59.46 seconds.\n",
      "--------------------------------------------------------------------------------\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<mindsponge.core.sponge.Sponge at 0x7fb108186070>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "md.run(1000, callbacks=[run_info, cb_h5md])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "mindspore-1.9",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  },
  "vscode": {
   "interpreter": {
    "hash": "768f82fbbece3f0acd424cda825de8aa44edbfaa38d8a3df4ff1437f7ae7861f"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
